/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2015-2019.
 * Description: header for idump bin format
 * Author: nixiaoming
 * Create: 2015-8-29
 */

#ifndef _BINFMT_IDUMP_H
#define _BINFMT_IDUMP_H
#include <linux/idump_debug.h>
#include <linux/elf.h>

#ifdef CONFIG_RTOS_IDUMP
struct got_dyn {
	struct elf_shdr got;
	struct elf_shdr dynamic;
};

#define idump_align_down(addr, size)	((addr) & (~((size) - 1)))

static int idump_load_got_dyn(const struct elfhdr *elf_hdr, struct file *elffile,
		struct got_dyn *info);

static void idump_count_got_dyn_vaddr(struct got_dyn *info, struct elf_phdr *elf_ppnt,
		unsigned long base);

#else
#define elf_core_vma_data_size_task(gate_vma, mm_flags, task) \
	elf_core_vma_data_size(gate_vma, mm_flags)

static inline unsigned long smart_vma_dump_size(unsigned long *begin,
		struct vm_area_struct *vma, struct coredump_params *cprm)
{
	return 0;
}

#define get_got_and_dynamic_offset(a, b) do {} while (0)
#endif

#endif
